﻿using System.Collections;
using System.Collections.Generic;
namespace Mota.XMLControls
{
    public abstract class GuiGroupBox:GuiControl,IEnumerable
    {
        private List<GuiControl> _children;

        public GuiGroupBox()
        {
            _children = new List<GuiControl>(0);
        }
        public override void Add(GuiControl guiControl)
        {
            _children.Add(guiControl);
        }

        public override IEnumerator GetEnumerator()
        {
            return _children.GetEnumerator();
        }

        public override bool Required
        {
            get
            {
                return false;
            }
            set
            {
                //disable to set required
            }
        }
        public override void Accept(GuiVisitor visitor)
        {

            visitor.Visit(this);
            foreach (GuiControl child in this)
            {
                child.Accept(visitor);
            }
        }
    }
}
